package com.le.tester.javaThink.fifth.chapter14_StreamingProgramming;

import java.util.stream.Stream;

/**
 * 描述：map将一个字符串转化成另一个字符串
 */
public class FunctionMap2 {
    public static void main(String[] args) {
        Stream.of(1, 5, 7, 9, 11, 13)
                //这里可以进行类型的转换
                .map(Numbered::new)
                .forEach(System.out::println);
    }
}

class Numbered {
    final int n;

    public Numbered(int n) {
        this.n = n;
    }

    @Override
    public String toString() {
        return "Numbered{" +
                "n=" + n +
                '}';
    }

}
